const express = require("express");

const { ROUTES } = require("./routes"); //路由配置

const { setupLogging } = require("./logging");
const { setupRateLimit } = require("./ratelimit");
const { setupCreditCheck } = require("./creditcheck");
const { setupProxies } = require("./proxy");
const { setupAuth } = require("./auth");

const app = express();
const port = 8896;

setupLogging(app); //日志记录功能
setupRateLimit(app, ROUTES); //速率限制
setupAuth(app, ROUTES); //身份验证
setupCreditCheck(app, ROUTES); //信用检测，检测代码自定义实现
setupProxies(app, ROUTES); //代理配置

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});
